﻿using System;
using System.Speech.Synthesis;
using System.Windows.Forms;

namespace power_car.Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SpeechSynthesizer voice = new SpeechSynthesizer();   //创建语音实例
            voice.Rate = 0; //设置语速,[-10,10]
            voice.Volume = 100; //设置音量,[0,100]
            voice.SpeakAsync("Hellow Word");  //播放指定的字符串,这是异步朗读

            //下面的代码为一些SpeechSynthesizer的属性，看实际情况是否需要使用

            /*voice.SpeakAsyncCancelAll();  //取消朗读
            voice.Speak("你好啊");  //同步朗读
            voice.Pause();  //暂停朗读
            voice.Resume(); //继续朗读

            voice.Dispose();  //释放所有语音资源*/
        }
    }
}
